<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    *{
        margin: 0;
        padding: 0;
    }
    ul{
        list-style: none;
        
    }
    .big{
        width: 340px;
        height: 30px;
        margin: 100px auto;
        background: url(./imgs/bg.jpg);
    }
    .big>li{
        float: left;
        text-align: center;
        height: 30px;
        width: 100px;
        line-height: 30px;
        margin-left: 10px;

    }
    li{
        background: url(./imgs/libg.jpg);
    }
    .smll{
        display: none;
    }
</style>
<body>
    <ul class="big">
        <li>第一阶级
            <ul class="smll">
                <li>第二阶级</li>
                <li>第二阶级</li>
                <li>第二阶级</li>
            </ul>
        </li>
        <li>第一阶级
            <ul class="smll">
                <li>第二阶级</li>
                <li>第二阶级</li>
                <li>第二阶级</li>
            </ul>
        </li>
        <li>第一阶级
            <ul class="smll">
                <li>第二阶级</li>
                <li>第二阶级</li>
                <li>第二阶级</li>
            </ul>
        </li>
    </ul>
</body>
<script>
    var big = document.querySelectorAll('.big>li')
    var smll = document.querySelectorAll('.smll')


    big.forEach((item,index)=>{
        item.onmouseover = function(){
            smll[index].style.display = 'block'
        }
        item.onmouseout = function(){
            smll[index].style.display = 'none'
        }
    })
</script>
</html>